<template>
    <div>
        <el-dialog title="控制编号修改" :visible.sync="formDialog.controlNumber" width="600px"  center>
            <el-form :model="controlNumberObj" style="margin-left: 50px;">
                <el-form-item label="文件类型" :label-width="formLabelWidth">
                    {{controlNumberObj.fileType}}
                </el-form-item>
                <el-form-item label="文件名称" :label-width="formLabelWidth">
                    {{controlNumberObj.fileName}}
                </el-form-item>
                <el-form-item label="文件控制编号" :label-width="formLabelWidth">
                    <el-input  v-model.trim="controlNumberObj.fileNo" style="width: 300px"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="formDialog.controlNumber = false">取 消</el-button>
                <el-button type="primary" @click="confirmModify">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        name: "ControlNumberDialog",
        props:{
            formDialog:{type:Object},
            controlNumberObj:{type:Object},
            oldControlNumberObj:{type:Object},
        },
        data(){
            return{
                formLabelWidth: '120px'
            }
        },
        methods:{
            confirmModify(){
                if (JSON.stringify(this.controlNumberObj.fileNo) == JSON.stringify(this.oldControlNumberObj.fileNo)){
                    this.$message({
                        type:"warning",
                        message:"您要修改的数据与原数据相同,请重新修改"
                    })
                } else {
                    this.$emit("confirmModify",{...this.controlNumberObj});
                    this.formDialog.controlNumber = false;
                }
            }
        }
    }
</script>

<style lang="scss" scoped>
    /deep/ .el-dialog__body {
        margin: 0 auto;
    }
</style>